import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
import {
  BrowserRouter as Router,
  Route,
  Switch,
  Redirect
} from 'react-router-dom'
import 'antd/dist/antd.css'
import { whiteList } from './routes'

ReactDOM.render(
  <>
    <Router>
      <Switch>
        {whiteList.map(route => {
          return (
            <Route
              key={route.path}
              path={route.path}
              component={route.component}
            />
          )
        })}
        <Route path="/admin" component={App} />
        <Redirect to="/admin" from="/" exact />
        <Redirect to="/404" />
      </Switch>
    </Router>
  </>,
  document.getElementById('root')
)
